package cn.qh.com.mapper;

import cn.qh.com.model.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @project: crud
 * @description:
 * @author:
 * @date: 2021-08-17-11:27
 * @version: 1.0
 * @website:
 */
public interface Mapper {


    //根据id查询
    @Select("select pid,username,password,gender,birth from person where pid =#{id}")
    public Person queryById(int id);
    //查询所有的信息
    @Select("select pid,username,password,gender,birth from person ")
    public List<Person> queryAll();
    //根据添加信息
    @Insert("insert into person values(null,#{username},#{password},#{gender},#{birth})")
    public void insert(Person person);
    //根据id删除信息
    @Delete("delete from person where pid = #{id} ")
    public int delete(int id);
    //更新数据
    @Update("update person set username= #{username},password=#{password},gender=#{gender},birth=#{birth}) where pid =#{id}")
    public void update(Person person);
}
